package com.deyuanyun.pic.ctrl.util;

import org.apache.commons.beanutils.BeanUtils;

import java.lang.reflect.InvocationTargetException;
import java.util.List;

/**
 * 处理绝对距离类
 *
 * @author scalpel.王敏
 * @version [v1.0] 创建时间（2016/9/20）
 * @see // 引用的类
 * Method List:
 * 1.----------------
 * 2.----------------
 * History:
 */
public class HandlerMileage implements HandlerService {
    List<Double> mileageList=null;
    private int index=0;

    public  HandlerMileage(List<Double> mileageList)
    {
        this.mileageList=mileageList;
    }
    @Override
    public void  callback(Object obj, String... args) {
        synchronized (mileageList)
        {
            Double mileage = mileageList.get(0)*1000;
            mileageList.remove(0);
            try {
                BeanUtils.setProperty(obj,"mileage",Double.toString(mileage));
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (InvocationTargetException e) {
                e.printStackTrace();
            }
        }

    }

    @Override
    public String getExecuteResult() {
        return null;
    }
}
